// Created: Dec 13, 2014
//
// Author: wjinwen.1988@gmail.com

#ifndef CHI_NET_CALLBACKS_H
#define CHI_NET_CALLBACKS_H

#include <stdint.h>
#include <functional>
#include <memory>

namespace chi {
namespace net {

class Buffer;
class TcpConnection;
class TLSConnection;

typedef std::shared_ptr<TcpConnection> TcpConnectionPtr;

using NewConnectionCallback = std::function<void (int sockfd)>;
using EventCallback = std::function<void()>;
using TimeoutCallback = std::function<void(uint64_t)>;
using Functor = std::function<void ()>;
using ConnectionCallback = std::function<void (const TcpConnectionPtr& )>; 
using CloseCallback = std::function<void (const TcpConnectionPtr& )>;
using ErrorCallback = std::function<void (const TcpConnectionPtr& )>;

using MessageCallback = std::function<void (const TcpConnectionPtr& ,
                                            Buffer* )>;
void DefaultConnectionCallback(const TcpConnectionPtr& conn);
void DefaultMessageCallback(const TcpConnectionPtr& conn, Buffer* message);
}
}
#endif 
